<?php 


$info=json_decode('[{"company_name":"中文Jinan Saint Best Machinery Co.,Ltd","address":"RM1922\uff0cBLDG NO 1\uff0cNO.88 WEST HUIZHAN RD,JINAN,GAOXIN DISTRICT,CHINA","email":"sales@saintbestgroup.com,saintbestgroup@163.com","phone":"0086-18660425078,0086-15665873459"}]');

var_dump($info);

var_dump($info[0]->company_name);
updateInfo("root","qqs","123456",$info);

function updateInfo($user,$db,$pw,$info){
$con=mysqli_connect("localhost",$user,$pw,$db);
// 检测链接
if (mysqli_connect_errno($con))
{
    echo "连接到 MySQL 失败: " . mysqli_connect_error();
}


$sql = "UPDATE wp_postmeta SET meta_value = '".$info[0]->company_name."' WHERE post_id = 50 and meta_key = 'lianxi_company';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->address."' WHERE post_id = 50 and meta_key = 'lianxi_adress';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->email."' WHERE post_id = 50 and meta_key = 'lianxi_mail_01';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->phone."' WHERE post_id = 50 and meta_key = 'lianxi_phone_01';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->email02."' WHERE post_id = 50 and meta_key = 'lianxi_mail_02';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->phone02."' WHERE post_id = 50 and meta_key = 'lianxi_phone_02';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->fax."' WHERE post_id = 50 and meta_key = 'lianxi_fax';";
$sql =$sql . "UPDATE wp_postmeta SET meta_value = '".$info[0]->whatsapp."' WHERE post_id = 50 and meta_key = 'lianxi_whatsapp';";






var_dump($sql);
mysqli_multi_query($con,$sql);
mysqli_close($con);
}







?>